package prototype.persistence.hibernate;

import java.util.List;
import java.sql.Timestamp;

import prototype.persistence.pojo.Goal;
import prototype.persistence.GoalDAO;

import org.hibernate.criterion.Restrictions;

/**
 * <p>Hibernate DAO layer for Goals</p>
 * <p>Generated at Sun Jan 03 13:49:53 EET 2010</p>
 *
 * @author Salto-db Generator v1.0.16 / Pojos + Hibernate mapping + Generic DAO
 * @see http://www.hibernate.org/328.html
 */
public class GoalHibernateDAO extends
		AbstractHibernateDAO<Goal, Integer> implements
		GoalDAO {

	/**
	 * Find Goal by name
	 */
	public List<Goal> findByName(String name) {
		return findByCriteria(Restrictions.eq("name", name));
	}
	
	/**
	 * Find Goal by type
	 */
	public List<Goal> findByType(Integer type) {
		return findByCriteria(Restrictions.eq("type", type));
	}
	
	/**
	 * Find Goal by timeLimit
	 */
	public List<Goal> findByTimeLimit(Integer timeLimit) {
		return findByCriteria(Restrictions.eq("timeLimit", timeLimit));
	}
	
	/**
	 * Find Goal by radius
	 */
	public List<Goal> findByRadius(Integer radius) {
		return findByCriteria(Restrictions.eq("radius", radius));
	}
	
	/**
	 * Find Goal by civilLimit
	 */
	public List<Goal> findByCivilLimit(Integer civilLimit) {
		return findByCriteria(Restrictions.eq("civilLimit", civilLimit));
	}
	
	/**
	 * Find Goal by positionId
	 */
	@SuppressWarnings("unchecked")
	public List<Goal> findByPositionId(Integer positionId) {
		return findByCriteria(Restrictions.eq("position.positionId", positionId));
	}
	
	/**
	 * Find Goal by userId
	 */
	@SuppressWarnings("unchecked")
	public List<Goal> findByUserId(Integer userId) {
		return findByCriteria(Restrictions.eq("user.userId", userId));
	}
	

}
